<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      for (var i = 1; i <= 5; i++) {
        (function (i) {
          setTimeout(function timer() {
            console.log(i);
          }, i * 1000);
        })(i);
      }
      console.log(i);

      var obj1 = { a: 1, b: 2, c: 3, d: { e: 4 } };
      var obj2 = { ...obj1 };
      obj1.a = 2;
      obj1.d.e = 5;
      console.log(obj2);

      setTimeout(function () {
        console.log(1);
      }, 0);

      new Promise(function (resolve) {
        console.log(2);
        resolve();
        console.log(3);
      }).then(function () {
        console.log(4);
      });

      const arr = [12, 24, 37, 24, 49, 49];
      const res = Array.from(new Set(arr));
      console.log(res);
    </script>
  </body>
</html>
